/******************************************************************************
 * Copyright (C) 2021 Batonova
 * All rights reserved.
 *****************************************************************************/

/**
 * @file dra/core/defines.h
 * @brief A macro definition for creating namespace.
 *
 * Macro definition that fixed with dra as the first layer of namespace
 *
 * @author batonova
 * @date 25 June 2021
 */


#ifndef DRA_CORE_DEFINES_H_
#define DRA_CORE_DEFINES_H_

#include <stdlib.h>
#include <string>
// #include "cmake_config.h"
// #include "gosversion_config.h"

#define WITH_SOMEIP
#define WITH_E2EXF

#ifndef DRA_NAMESPACE_BEG
#define DRA_NAMESPACE_BEG(X) \
  namespace dra {            \
  namespace X {
#endif

#ifndef DRA_NAMESPACE_END
#define DRA_NAMESPACE_END \
  }                         \
  }
#endif


#if defined _WIN32 || defined __CYGWIN__
  #ifdef BUILDING_DLL
    #ifdef __GNUC__
      #define DLL_PUBLIC extern "C" __attribute__ ((dllexport))
      #define DRA_EXPORT __attribute__ ((dllexport))
    #else
      #define DLL_PUBLIC extern "C" __declspec(dllexport)  // Note: actually gcc seems to also supports this syntax.
      #define DRA_EXPORT __declspec(dllexport)             // Note: actually gcc seems to also supports this syntax.
    #endif
  #else
    #ifdef __GNUC__
      #define DLL_PUBLIC extern "C" __attribute__ ((dllimport))
      #define DRA_EXPORT __attribute__ ((dllimport))
    #else
      #define DLL_PUBLIC extern "C" __declspec(dllimport)  // Note: actually gcc seems to also supports this syntax.
      #define DRA_EXPORT __declspec(dllimport)             // Note: actually gcc seems to also supports this syntax.
    #endif
  #endif
  #define DLL_LOCAL
  #define DRA_EXPORT
#else
  #if __GNUC__ >= 4
    #define DLL_PUBLIC extern "C" __attribute__ ((visibility ("default")))
    #define DLL_LOCAL  extern "C" __attribute__ ((visibility ("hidden")))
    #define DRA_EXPORT __attribute__ ((visibility ("default")))
  #else
    #define DLL_PUBLIC
    #define DLL_LOCAL
    #define DRA_EXPORT
  #endif
#endif

#ifdef BUILD_GMOCK
  #define GTEST_VIRTUAL virtual
  #define GTEST_FINAL
  #define GTEST_DELETE
#else
  #define GTEST_VIRTUAL
  #define GTEST_FINAL   final
  #define GTEST_DELETE  = delete
#endif

#endif  // DRA_CORE_DEFINES_H_
